//
//  LBXBWFilter.mm
//  OpenGLGame
//
//  Created by Nguyen Cong Huy on 4/5/13.
//  Copyright (c) 2013 UIT. All rights reserved.
//

#include "LBXBWFilter.h"
#include "LBToneCurveFilter.h"
#include "LBSharpenFilter.h"
#include "LBVignetteFilter.h"
#include "LBUtils.h"
#include "LBGreyscaleFilter.h"

LBXBWFilter::LBXBWFilter(){
    toneCurves = new LBToneCurveFilter();
    
    vignette = new LBVignetteFilter();
    vignette->setStart(0.5);
    vignette->setEnd(0.9);
    
    sharpen = new LBSharpenFilter();
    sharpen->setSharpness(0.2);
    
    greyscale = new LBGreyscaleFilter();
    
    toneCurves->addTarget(sharpen)->addTarget(sharpen)->addTarget(vignette)->addTarget(greyscale);
    firstFilter = toneCurves;
}

LBXBWFilter::~LBXBWFilter(){
    outputTexture = 0;
    DELETE_SAFELY(toneCurves);
    DELETE_SAFELY(vignette);
    DELETE_SAFELY(sharpen);
    DELETE_SAFELY(greyscale);
}

void LBXBWFilter::setToneAcvData(unsigned char* toneData){
    toneCurves->setCurveImageData(toneData);
}